﻿using CaffeeBuzz_WinForm.Cafe;
using CaffeeBuzz_WinForm.Factorys;
using CaffeeBuzz_WinForm.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CaffeeBuzz_WinForm.Commands
{
    public class CafeCommand:Command
    {
        private List<Item> beverages;
        private List<Condiment> condiments;
        private int _iBeverage = -1;
        public CafeCommand()
        {
            beverages = new List<Item>();
            beverages.Add(new HouseBlend());
            beverages.Add(new DarkRoast());

            condiments = new List<Condiment>();
            condiments.Add(new Mocha());
            condiments.Add(new Soy());
            condiments.Add(new Milk());
        }

        public CafeCommand(List<Item> beverages, List<Condiment> condiments)
        {
            this.beverages = beverages;
            this.condiments = condiments;
        }
        public void AddCondiments(int iCondiment)
        {
            condiments[iCondiment].Condiment_Beverage = beverages[_iBeverage];
            Condiment temp = (Condiment)Factory.CreateBeverage(condiments[iCondiment].Name);
            beverages[_iBeverage] = temp;
        }

        public string GetName()
        {
            return "Caffee";
        }
        public double Cost()
        {
            return beverages[_iBeverage].Price;
        }
        public List<Item> Beverages
        {
            get { return beverages; }
            set { beverages = value; }
        }
        public List<Condiment> Condiments
        {
            get { return condiments; }
            set { condiments = value; }
        }
        public int iBeverage
        {
            get
            {
                return _iBeverage;
            }
            set
            {
                if (0 <= _iBeverage && _iBeverage < beverages.Count)
                    _iBeverage = value;
            }
        }


        public void LoadFromFile(string FileName)
        {
            throw new NotImplementedException();
        }


        public Item GetItem(int index)
        {
            iBeverage = index;
            return Beverages[iBeverage];
        }
    }
}
